//根据id来关闭 modal
function closeModal(id) {
	$(id).modal("hide");
}
function toDate(date) {
	var y = date.getFullYear();
	var m = date.getMonth() + 1;
	var hour = date.getHours();
	var minute = date.getMinutes();
	m = m < 10 ? '0' + m : m;
	hour = hour < 10 ? '0' + hour
			: hour;
	minute = minute < 10 ? '0'
			+ minute : minute;
	var d = date.getDate();
	d = d < 10 ? ('0' + d) : d;
	return y + '-' + m + '-' + d
			+ " " + hour + ":"
			+ minute;
}
function toDateTime(data) {
	var date = new Date(data);
	var y = date.getFullYear();
	var m = date.getMonth() + 1;
	var hour = date.getHours();
	var minute = date.getMinutes();
	var s = date.getSeconds();
	m = m < 10 ? '0' + m : m;
	hour = hour < 10 ? '0' + hour
			: hour;
	minute = minute < 10 ? '0'
			+ minute : minute;
	s = s < 10 ? '0'
			+ s : s;
	var d = date.getDate();
	d = d < 10 ? ('0' + d) : d;
	return y + '-' + m + '-' + d
			+ " " + hour + ":"
			+ minute+":"+s;
}
function FormatDate(date) {
	return date.getFullYear() + "-" + (date.getMonth() + 1) + "-"
			+ date.getDate();
}
function showMsg(msg){
    $('body').append('<div class="layer" style="width:100%;height:100%;text-align:center;position:fixed;top:40%;">'
    		+'<span style="max-width:200px; background:#fff;color:#000;box-shadow:0px 0px 5px #000; text-align:left;display:inline-block;padding:5px 10px;border-radius:5px;-webkit-border-radius:5px;">'+msg+'</span></div>');
    setTimeout(function(){
        $(".layer").remove();
    },1000);
}
$(function() {
	//定时请求后台，保持通信畅通
	/*setInterval(function(){
		$.ajax({
			url : "requestSession.do",
			type : "post",
			dataType : "json",
			success : function(result) {
				console.log(3);
				if (result.status == true) {
				} else {
					swal({
						title : "提示",
						text : "登录失效，请重新登录！",
						type : "error",
						confirmButtonText : "确定"
					}, function() {
						window.location="homePage.do";
					});
					
				}

			},
			error : function() {
				sweetAlert("异常", "网络出现异常!",
						"error");
			}

		});// ajax end;
	},2000);*/
})

